# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=qmidinet
pkgver=0.9.9
pkgrel=1
pkgdesc="A MIDI Network Gateway via UDP/IP Multicast"
arch=(loong64 x86_64)
url="https://qmidinet.sourceforge.io"
license=(GPL2)
groups=(pro-audio)
depends=(
  gcc-libs
  glibc
  hicolor-icon-theme
  qt6-base
  qt6-svg
)
makedepends=(
  alsa-lib
  cmake
  jack
  qt6-tools
)
optdepends=(
  'qt6-wayland: for native wayland support'
)
source=(https://downloads.sourceforge.net/project/$pkgname/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz)
sha512sums=('77e1bb6b9a5e20ed90f7778f6cd8bc39f66faeb5d3c0b7fc5f60901455655ce6d2f7cb06b1d3df4f25db1c6611eb0a1fa960c488341dad18ded30414df51dafb')
b2sums=('8cf52793eb0a3f2b2446c50ca961ef9710cb733c4204b9950fcb4c9e8751344df1654b8b222a6fe0efc3daf1a520f84a0c3700c2fd01121d6fbab4a5fe5c5b09')

build() {
  local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CONFIG_QT6=ON
    -S $pkgname-$pkgver
    -W no-dev
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

package() {
  depends+=(
    alsa-lib libasound.so
    jack libjack.so
  )

  DESTDIR="$pkgdir" cmake --install build
  install -vDm 644 $pkgname-$pkgver/{ChangeLog,README} -t "$pkgdir/usr/share/doc/$pkgname"
}
